package org.budo.activiti.form.type;

import java.util.Map;

import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.impl.form.EnumFormType;

/**
 * @author lmw
 */
public class BudoEnumFormType extends EnumFormType {
    private static final long serialVersionUID = 8746236200784460454L;

    public static final String NAME = "budo_enum";

    public BudoEnumFormType(Map<String, String> values) {
        super(values);
    }

    @Override
    public String getName() {
        return NAME;
    }

    @Override
    protected void validateValue(String value) {
        if (value != null) {
            if (this.values != null && !this.values.containsKey(value)) {
                throw new ActivitiIllegalArgumentException("#22 Invalid value for enum, value=" + value + ", values=" + this.values);
            }
        }
    }
}